home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 531 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.4 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Bit-field sizes
  5. Date: 07 Mar 1996 03:23:00 GMT
  6. Organization: Los Alamos National Laboratory
  7. Distribution: world
  8. Message-ID: <TANMOY.96Mar6202300@qcd.lanl.gov>
  9. References: <nzRPxQ9ytZZA084yn@csn.net> <4hkgds$bbh@info1.sdrc.com>
  10.     <uYgPxQ9ytt9W084yn@csn.net>
  11. NNTP-Posting-Host: qcd.lanl.gov
  12. Mime-Version: 1.0
  13. Content-Type: text
  14. In-reply-to: thads@csn.net's message of 6 Mar 1996 14:56:50 -0700
  15.  
  16. In article <uYgPxQ9ytt9W084yn@csn.net>
  17. thads@csn.net (Thad Smith) writes:
  18.  
  19. TS: In article <4hkgds$bbh@info1.sdrc.com>,
  20. TS: larry.jones@sdrc.com (Larry Jones) wrote:
  21. TS: >In article <nzRPxQ9ytZZA084yn@csn.net>, thads@csn.net (Thad Smith) writes:
  22. TS: >> Can the size of a bit-field, measured in bits, exceed the size of an
  23. TS: >> int?  The description of bit-fields describes it as an integral
  24. TS: >> type with a (programmer-)specified number of bits, not specifically
  25. TS: >> constrained in size.  ANSI Classic section 3.2.1.1 says, however, that
  26. TS: >> bit-fields are promoted to either int or unsigned int.  
  27. TS: >
  28. TS: >No.  ANSI Classic 3.5.2.1:
  29. TS: >
  30. TS: >    The expression that specifies the width of a bit-field shall be
  31. TS: >    an integral constant expression that nas nonnegative value that
  32. TS: >    shall not exceed the number of bits in an ordinary object of
  33. TS: >    compatible type.
  34. TS: >
  35. TS: >The constraint is historical, probably because extracting a bit-field
  36. TS: >that is longer than a word is sufficiently complicated as to be contrary
  37. TS: >to the ``spirit of C''.
  38. TS: 
  39. TS: What does "ordinary object of compatible type" mean?  Could that mean
  40. TS: long?  I now think that an implementation could allow specification of
  41.  
  42. I don't think so. The bit fields are either int or unsigned, an
  43. ordinary object of compatible type is therefore an int or an
  44. unsigned. If bitfields could be `long', it would have allowed long.
  45.  
  46. Cheers
  47. Tanmoy
  48. --
  49. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  50. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  51. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  52. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  53. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  54. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  55.